/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.system.mapper;


import com.koron.system.domain.Message;

import org.apache.ibatis.annotations.Param;


import java.util.Date;
import java.util.List;


public interface MessageMapper {
    /**
     * 新增消息
     * @param message
     * @return
     */
    Integer insert(@Param("message") Message message);

    /**
     * 批量新增消息
     * @param messageList
     * @return
     */
    Integer batchInsert(@Param("messageList") List<Message> messageList);

    /**
     * 修改消息
     * @param message
     * @return
     */
    Integer update(@Param("message") Message message);

    /**
     * 批量修改消息
     * @param messageList
     * @return
     */
    Integer batchUpdate(@Param("messageList") List<Message> messageList);

    /**
     * 逻辑删除数据
     * @param idList
     * @return
     */
    Integer batchDeteleLogic(@Param("idList")List<String> idList);

    /**
     * 根据主键获取消息详情
     * @param id
     * @return
     */
    Message queryOne(@Param("id") String id);

    /**
     * 根据指定条件获取消息列表
     * @param receiverCode
     * @param beginTime
     * @param endTime
     * @param start
     * @param rows
     * @return
     */
    List<Message> queryByCondition(@Param("receiverCode") String receiverCode, @Param("beginTime") Date beginTime,@Param("endTime") Date endTime,
                                   @Param("start") Integer start,@Param("rows") Integer rows,@Param("keyword") String keyword);

    /**
     * 根据指定条件统计消息数量
     * @param receiverCode
     * @param beginTime
     * @param endTime
     * @return
     */
    Integer countByCondition(@Param("receiverCode") String receiverCode, @Param("beginTime") Date beginTime,@Param("endTime") Date endTime,@Param("keyword") String keyword);

    Integer getIsReadCount(@Param("userCode")String userCode, @Param("isRead")Integer isRead);

    Integer getToDoCount(@Param("userCode")String userCode, @Param("state")Integer state);

    Integer getAuditCount(@Param("idList")List<String> idList,@Param("state")Integer state);
}
